package com.huang.A02_constructor;

public class MovieOperator {
    private Movie[] movies;

    public MovieOperator(Movie[] movies){
        this.movies = movies;
    }

    //打印全部电影信息
    public void printAllMovies(){
        for (int i = 0; i < movies.length; i++) {
            Movie m = movies[i];
            System.out.println("电影编号是：" + m.getId());
            System.out.println("电影名是：" + m.getName());
            System.out.println("电影价格是：" + m.getPrince());
            System.out.println("电影主演是：" + m.getActor());
            System.out.println("电影导演是：" + m.getDirector());
            System.out.println("电影评分是：" + m.getScore());
            System.out.println("电影其他信息是：" + m.getInfo());
            System.out.println("-------------------");
        }
    }

    //根据id查询电影信息
    public void selectMovieById(int id){
        for (int i = 0; i < movies.length; i++) {
            Movie m = movies[i];
            if(m.getId() == id){
                System.out.println("你查询的电影信息如下：");
                System.out.println("电影编号是：" + m.getId());
                System.out.println("电影名是：" + m.getName());
                System.out.println("电影价格是：" + m.getPrince());
                System.out.println("电影主演是：" + m.getActor());
                System.out.println("电影导演是：" + m.getDirector());
                System.out.println("电影评分是：" + m.getScore());
                System.out.println("电影其他信息是：" + m.getInfo());
            }
        }
    }
}